// pages/shaixuanresult/shaixuanresult.js
import request from '../../utils/request'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    receive1:" ",
    receive2:" ",
    counselorList:[]
  },
  onClickLeft(){
    wx.navigateBack({
      delta: 1 
    })
  },
  tiaoZhuan(){
    wx.navigateTo({
      url: '/pages/counselorDetail/counselorDetail',
    })
  },
  onTiaoZhuan(e){
    const data = e.currentTarget.dataset;
    console.log(data);
    wx.navigateTo({
      url: `/pages/teacherInfo/teacherInfo?item=`+JSON.stringify(data.data),
    })
  },
  showTeacher(){
    wx.request({
      url: 'http://localhost:8080/consultant/findConsultant',
      method:'GET',
      data:{
        field:this.data.receive2,
        levelName:this.data.receive1
      },
      success:(res)=>{
        console.log(res.data);
        this.setData({
          counselorList:res.data.data
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    const vanCellTitle1 = wx.getStorageSync('vanCellTitle1');
    const vanCellTitle2 = wx.getStorageSync('vanCellTitle2');
    this.setData({
      receive1:vanCellTitle1,
      receive2:vanCellTitle2
    });
    console.log("接收到的数据1:",this.data.receive1);
    console.log("接收到的数据2:",this.data.receive2);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.showTeacher();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})